<template>
  <view>
    <view class="title"> 请扫描用户订单对应的二维码 </view>
    <view>
      <image
        @click="scanCode"
        class="image-scan"
        src="https://img.qumoyugo.com/webimgbg/qr_code_scanner_example@2x.png"
      />
      <button class="input-code" @click="inputCode">输入编码验券</button>
    </view>
    <view class="image-botton-box">
      <image class="img" src="https://img.qumoyugo.com/webimgbg/nurse_order_scan_bg@2x.png" />
    </view>

    <view>
      <view class="popup" v-show="popShow">
        <view class="mask" catchtouchmove="preventTouchMove" catchtap="closePop" @tap="popShow = false"> </view>
        <view class="popup_main" id="popup_main">
          <view class="title-input">请输入核销码</view>
          <input v-model="verificationCode" class="code-input" type="text" />
          <button class="confim" @click="checkCode">确认核销</button>
        </view>
      </view>
    </view>
  </view>
</template>

<script setup>
import { ref, onMounted } from 'vue'
const popShow = ref(false)
const verificationCode = ref()
const inputCode = () => {
  popShow.value = true
}
const checkCode = () => {
  popShow.value = false
}
onMounted(() => {
  // 在组件挂载后执行的逻辑
})
const scanCode = () => {
  uni.scanCode({
    scanType: ['qrCode'],
    success: function (res) {}
  })
}
</script>

<style lang="scss" scoped>
.title {
  text-align: center;
  margin-top: 136rpx;
  font-size: 32rpx;
  font-family: PingFang SC;
  font-weight: 400;
  color: #333333;
}

.image-scan {
  position: relative;
  display: inline-block;
  width: 338rpx;
  height: 338rpx;
  margin-left: 206rpx;
  margin-top: 86rpx;
}

.image-camera {
  position: absolute;
  top: 18rpx;
  left: 18rpx;
  background: url('https://img.qumoyugo.com/webimgbg/qr_code_scanner_example@2x.png');
  width: 300rpx;
  height: 300rpx;
}

.input-code {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 60rpx;
  width: 390rpx;
  height: 83rpx;
  background: #525fa2;
  border-radius: 11rpx;
  font-size: 28rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #ffffff;
  text-align: center;
}

.image-botton-box {
  width: 100%;
  text-align: center;
  margin-top: 130rpx;
}

.img {
  text-align: center;
  margin: 0 auto;
  width: 515.28rpx;
  height: 363.19rpx;
}
.popup {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
}
.mask {
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.3);
}
.popup_main {
  position: fixed;
  top: 631rpx;
  left: 50%;
  width: 556rpx;
  height: 360rpx;
  background: #ffffff;
  border-radius: 18rpx;
  transform: translate(-50%, -50%);
  box-sizing: border-box;
  background-color: #fff;
}
.title-input {
  margin-top: 52rpx;
  text-align: center;
  font-size: 28rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #262626;
}
.code-input {
  margin-left: 67rpx;
  margin-top: 53rpx;
  width: 417rpx;
  height: 61rpx;
  background: #ffffff;
  border: 1px solid #999999;
  border-radius: 8rpx;
}
.confim {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 34rpx;
  width: 278rpx;
  height: 63rpx;
  background: #525fa2;
  font-size: 26rpx;
  border-radius: 11rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #ffffff;
}
</style>
